1. Field of the Invention
The present invention relates generally to displaying video and computer images, and more specifically to an improved system and method for coding colors and storing compensation factors used in converting colors of pixels from one color space to another color space and restoring thereto.
2. Related Art
An image to be displayed on a monitor or television screen is represented by a matrix of points referred to as pixels. The pixels are scanned across the monitor or screen both horizontally and vertically. Each pixel has an associated color that is typically represented by a particular set of values of three different components. The three different components used to represent the color define a color space.
The color space is a mathematical representation of a set of colors. Several color spaces are presently used in various different applications. An RGB color space represents color as levels of red (R), green (G), and blue (B). The RGB color space is generally used in color computer graphics. A YUV color space represents color as intensity (Y) and two color difference components (U, V). The YUV color space is generally used in television equipment and was developed to accommodate both black-and-white and color televisions. Other color spaces include CMYK, HSI, and HSV.
Each color space has been developed according to various industry standards. These standards define a valid range of values for each of the respective components referred to as a valid component range. These standards also define equations and coefficients to be used to convert the color of a pixel from one color space to another color space. For example, conversion between the RGB color space and the YUV color space is accomplished with a well established set of equations.
Conversion of the color between various color spaces is necessary as the lines between computer equipment and television equipment become blurred. For example, multimedia systems employing a computer system to display television images must convert the television image into an image displayable on the computer. The multimedia system must convert the television image from the YUV color space to a computer image in the RGB color space.
One problem associated with this conversion is due to the valid component ranges of the components in the respective color spaces. The valid component ranges in a particular color space can be represented as a rectangular cube in three dimensional space. Each color in the particular color space is defined by a set of three points referred to as a triplet, within the rectangular cube. A triplet having each of its components within the valid component range of the color space, and hence, within the cube of the color space, is referred to as a valid triplet. A triplet having one or more components outside the valid component range of the color space, or outside the cube of the color space, is referred to as an invalid triplet.
A cube representing the RGB color space (RGB cube) lies entirely within a cube representing the YUV color space (YUV cube). Thus, every valid RGB triplet corresponds to a valid YUV triplet. The reverse however, is not true. That is, not every valid YUV triplet corresponds to a valid RGB triplet. This is so because some valid YUV triplets lie outside the RGB cube.
One method that conventional systems have used to address invalid RGB triplets is to clip each invalid component to its maximum (or minimum) value. This method produces an undesirable color shift that, in many cases, is readily apparent to the viewer.
Another method that conventional systems have used to address invalid RGB triplets is to choose RGB values that hold luminance and hue constant and reduce saturation until the invalid RGB triplet becomes valid. This method shifts bright colors to white and dark colors to black. As a result, the overall displayed image becomes more black and white. This effect is also readily apparent to the viewer.
A second problem associated with the conversion of a color between color spaces is due to conventional systems attempting to solve the first problem. Once a conventional system has adjusted, or compensated the invalid RGB triplet to be within the valid RGB component range, the original YUV triplet can not be subsequently recovered from the compensated RGB triplet. Thus, in conventional systems, not only is some color information lost during the conversion, but conventional systems do not provide a means for recovering the lost color information.
The above referenced U.S. Patent Application by Masterson el al. addresses both the first and second problems as described above. Specifically, Masterson el al. addresses the first problem by disclosing a system and method that compensates for invalid colors in the second space by using a constant hue algorithm. This constant hue algorithm blends an invalid color in the second color space with a pure grey color resulting in a valid color in the second color space. The blending adjusts the color's saturation and luminance without affecting the color's hue.
Thus, Masterson et al. discloses a system and method for color space conversion that preserves the quality of the original image with respect to the viewer without undesirable hue shifts introduced by conventional systems.
Additionally, Masterson et al. addresses the second problem by disclosing a system and method that allows the original image to be subsequently recovered without any loss of color information. Specifically, Masterson et al. describes a system and method for storing the compensation factor that can be used to restore the original color in the first color space. Further, a method is described that allows for such storage without requiring additional and costly storage devices. More specifically, Masterson et al. discloses that the compensation factor is stored in the alpha channel.
Generally, the alpha channel is used for storing opacity information. Thus, the solution for storing the compensation factor in the alpha channel is beneficial for systems that do not ordinarily use the alpha channel for storing opacity or other information. However, when the alpha channel is being used, another means to store the compensation factor must be provided. This can be problematic because many existing systems do not have such available storage space. In addition, providing such additional storage space is costly. Accordingly what is needed is a means for storing the compensation factor that can be used in existing systems and which does not require additional and costly storage devices.